package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetSellerOrderInfoByProductIdBean;
import com.ymatou.query.trading.api.service.GetSellerOrderInfoByProductIdCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.constant.ECode;

/**
 * 根据商品id获取买家相关订单信息 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetSellerOrderInfoByProductId {

	private static GetSellerOrderInfoByProductIdBean getsellerorderinfobyproductidbean;
	private static GetSellerOrderInfoByProductIdCall getsellerorderinfobyproductidcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("根据商品id获取买家相关订单信息");
	}

	@Before
	public void caseUp() {

		getsellerorderinfobyproductidbean = new GetSellerOrderInfoByProductIdBean();
		getsellerorderinfobyproductidcall = new GetSellerOrderInfoByProductIdCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getsellerorderinfobyproductidcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetSellerOrderInfoByProductId_001() {
		Logger.start(true,"根据商品id获取买家相关订单信息成功");
		try {
			// 参数
			// String ProductId = "fd28d1a9-17ff-4a0f-b8c9-91d1f6c65e66";
			String ProductId = "155ebee3-1c93-47db-9cad-a6eb9f6b6f2b";
			getsellerorderinfobyproductidbean.setProductId(ProductId);
			// int SellerId = 1605332;
			int SellerId = 288484;
			getsellerorderinfobyproductidbean.setSellerId(SellerId);
			// 发送请求
			getsellerorderinfobyproductidcall.setData(getsellerorderinfobyproductidbean);
			getsellerorderinfobyproductidcall.callService();
			Logger.comment("getsellerorderinfobyproductidcall send:"
					+ getsellerorderinfobyproductidcall.getEntityString());
			Logger.comment("getsellerorderinfobyproductidcall response:"
					+ getsellerorderinfobyproductidcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderinfobyproductidcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getsellerorderinfobyproductidcall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSellerOrderInfoByProductId_002() {
		Logger.start(true,"卖家用户id为空");
		try {
			// 参数
			// String ProductId = "fd28d1a9-17ff-4a0f-b8c9-91d1f6c65e66";
			String ProductId = "155ebee3-1c93-47db-9cad-a6eb9f6b6f2b";
			getsellerorderinfobyproductidbean.setProductId(ProductId);
			// int SellerId = 1605332;
			int SellerId = 288484;
			// getsellerorderinfobyproductidbean.setSellerId(SellerId);
			// 发送请求
			getsellerorderinfobyproductidcall.setData(getsellerorderinfobyproductidbean);
			getsellerorderinfobyproductidcall.callService();
			Logger.comment("getsellerorderinfobyproductidcall send:"
					+ getsellerorderinfobyproductidcall.getEntityString());
			Logger.comment("getsellerorderinfobyproductidcall response:"
					+ getsellerorderinfobyproductidcall.getReturnData());
			Logger.verifyEquals(ECode.ERROR400, getsellerorderinfobyproductidcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getsellerorderinfobyproductidcall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSellerOrderInfoByProductId_003() {
		Logger.start(true,"商品Id为空");
		try {
			// 参数
			// String ProductId = "fd28d1a9-17ff-4a0f-b8c9-91d1f6c65e66";
			String ProductId = "155ebee3-1c93-47db-9cad-a6eb9f6b6f2b";
			// getsellerorderinfobyproductidbean.setProductId(ProductId);
			// int SellerId = 1605332;
			int SellerId = 288484;
			getsellerorderinfobyproductidbean.setSellerId(SellerId);
			// 发送请求
			getsellerorderinfobyproductidcall.setData(getsellerorderinfobyproductidbean);
			getsellerorderinfobyproductidcall.callService();
			Logger.comment("getsellerorderinfobyproductidcall send:"
					+ getsellerorderinfobyproductidcall.getEntityString());
			Logger.comment("getsellerorderinfobyproductidcall response:"
					+ getsellerorderinfobyproductidcall.getReturnData());
			Logger.verifyEquals(ECode.ERROR500, getsellerorderinfobyproductidcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getsellerorderinfobyproductidcall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}